
class Sprite:
    def __init__(self,name,blood,attack):
        self.name = name
        self.blood = blood
        self.attack = attack
    def fight(self,enemy): #敌人
        if type(self) == type(enemy): #判断同阵营
            pass
        else:
            print(f'{self.name}正在攻击{enemy.name},{enemy.name}的血量即将被扣除{self.attack}')
            enemy.blood -- self.attack
            print(f'敌人还剩下{enemy.blood}')

class Zhi(Sprite):
    # def __init__(self,name,blood,attack):
    #     self.name = name
    #     self.blood = blood
    #     self.attack = attack
    # def fight(self,js):
    #     print(f'{self.name}正在攻击{js.name},僵尸的血量即将被扣除{self.attack}血量')
    #     js.blood -=self.attack #扣血
    #     print(f'僵尸还剩下{js.blood}')
    pass
class Jiang(Sprite):
    # def __init__(self,name,blood,attack):
    #     self.name = name
    #     self.blood = blood
    #     self.attack = attack
    # def chi(self,zw):
    #     print(f'{self.name}正在吃{zw.name},植物的血量即将被扣除{self.attack}血量')
    #     zw.blood -=self.attack #扣血
    #     print(f'植物还剩下{zw.blood}')
    pass


zw1 = Zhi('豌豆',1800,300)
zw2 = Zhi('香蕉',1200,400)
js1 = Jiang("铁通僵尸",3000,10)
js2 = Jiang('调高僵尸',4500,60)
zw1.fight(js1)
zw2.fight(js2)